//
//  YYJLNoticeDetailController.m
//  YuanyangJinlou
//
//  Created by mac004 on 2017/1/5.
//  Copyright © 2017年 suli19910309@qq.com. All rights reserved.
//

#import "YYJLNoticeDetailController.h"

@interface YYJLNoticeDetailController ()
{
    UILabel * timeLb;//时间
    UILabel * titleLb;//主题
    UIImageView * topPic;//头部图片
    UILabel * contentLb;//内容
    UIImageView * bottomPic;//尾部图片
}
@end

@implementation YYJLNoticeDetailController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.navigationController setNavigationBarHidden:NO animated:NO];
    [self setTitleView:@"公告详情"];
    [self setBackItem];
    [self creatUI];
}
-(void)creatUI{
    UIScrollView * _scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(10*PER_WIDTH, 0, SCREEN_WIDTH-24*PER_WIDTH, SCREEN_HEIGHT)];
    _scrollView.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:_scrollView];
    
    titleLb=[MyControl createLabelWithFrame:CGRectMake(10*PER_WIDTH, 15*PER_HEIGHT, _scrollView.width-20*PER_WIDTH, 15*PER_HEIGHT) Font:15 Text:@"预告,翡翠商贸实作培训课开课啦" Color:BLACK_COLOR];
    [_scrollView addSubview:titleLb];
    
    timeLb =[MyControl createLabelWithFrame:CGRectMake(titleLb.left, titleLb.bottom+15*PER_HEIGHT, titleLb.width, 14*PER_HEIGHT) Font:14 Text:@"2016-11-26" Color:FEELT_COLOR];
    [_scrollView addSubview:timeLb];
    
    topPic=[[UIImageView alloc]initWithFrame:CGRectMake(titleLb.left, timeLb.bottom+10*PER_HEIGHT, 331*PER_WIDTH, 150*PER_HEIGHT)];
    topPic.image=[UIImage imageNamed:@"img_gonggao1"];
    [_scrollView addSubview:topPic];
    
    contentLb=[MyControl createLabelWithFrame:CGRectMake(topPic.left, topPic.bottom+12*PER_HEIGHT, _scrollView.width-10*PER_WIDTH, 72*PER_HEIGHT) Font:12 Text:@"签到:已一周7天为签到周期。连续签到一天得1积分,2天得2积分,以此递增,连续签到第7天积分翻倍即14分。连续签到7天后,又重新计算签到周期,即又从1积分开始累积递增。周期内中断签到,再开始签到则算第一天。" Color:FEELT_COLOR];
    contentLb.numberOfLines=0;
    NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:contentLb.text];
    NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
    [paragraphStyle1 setLineSpacing:10*PER_HEIGHT];
    paragraphStyle1.alignment = contentLb.textAlignment;
    [attributedString1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [contentLb.text length])];
    [contentLb setAttributedText:attributedString1];
    CGFloat  contentHiehgt = [attributedString1 boundingRectWithSize:CGSizeMake(contentLb.width, 1000) options:1|2 context:nil].size.height;
    contentLb.height=contentHiehgt;
    [_scrollView addSubview:contentLb];

    bottomPic=[[UIImageView alloc]initWithFrame:CGRectMake(contentLb.left, contentLb.bottom+15*PER_HEIGHT, 331*PER_WIDTH, 150*PER_HEIGHT)];
    bottomPic.image=[UIImage imageNamed:@"img_gonggao2"];
    [_scrollView addSubview:bottomPic];
    
    _scrollView.contentSize=CGSizeMake(0, 399*PER_HEIGHT+contentHiehgt);
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
